<!--
 * @FilePath     : /study_code/html/float2.html
 * @Description  : 浮动停靠
 * @Date         : 2025-04-26 21:38:15
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-26 21:38:19
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
    <style>
      .parent {
        width: 400px;
        height: 200px;
        border: 1px solid lightcoral;
        margin: 10px;
      }
      .box {
        width: 40px;
        height: 40px;
      }

      .box1 {
        background-color: lightblue;
        opacity: 0.6;
      }

      .box2 {
        background-color: lightgoldenrodyellow;
        opacity: 0.6;
        float: left;
      }

      .box3 {
        background-color: lightseagreen;
        opacity: 0.6;
        float: right;
      }


      .box21 {
        background-color: lightblue;
        opacity: 0.6;
      }

      .box22 {
        background-color: lightgoldenrodyellow;
        opacity: 0.6;
        float: left;
      }

      .box23 {
        /* 这里停靠在已浮动元素的边缘 */
        background-color: lightseagreen;
        opacity: 0.6;
        float: left;
      }
    </style>
  </head>
  <body>
    <div class="parent">
      <div class="box box1">A1</div>
      <div class="box box2">B1</div>
      <div class="box box3">C1</div>
      <p>浮动元素B1,C1 靠在 父元素（红色边框盒子）边缘</p>
    </div>

    <div class="parent">
      <div class="box box21">A2</div>
      <div class="box box22">B2</div>
      <div class="box box23">C2</div>
      <div class="box box24">D2</div>
      <p>浮动元素C2 靠在 已浮动元素B2 边缘</p>
    </div>
    <script></script>
  </body>
</html>
